// pages/newspage/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    swiperlist:[
      {
        id:'1',
        imgurl:'https://636c-cloud1-0g61swsq1178bf0e-1316980158.tcb.qcloud.la/%E6%A8%AA%E5%B1%8F/%E9%A3%8E%E6%99%AF/4.jpg?sign=0feb845649adc48afd4d717ca69fb094&t=1677243064'
      },
      // {
      //   id:'2',
      //   imgurl:'https://636c-cloud1-0g61swsq1178bf0e-1316980158.tcb.qcloud.la/news/2.png?sign=fb9d53ebfade0c3c671082d2498b1ff9&t=1677466516'
      // },
      {
        id:'3',
        imgurl:'https://636c-cloud1-0g61swsq1178bf0e-1316980158.tcb.qcloud.la/%E6%A8%AA%E5%B1%8F/%E9%A3%8E%E6%99%AF/2.jpg?sign=717b3dec13f2e53dabd8d3ed1424866d&t=1677243053'
      },
      {
        id:'4',
        imgurl:'https://636c-cloud1-0g61swsq1178bf0e-1316980158.tcb.qcloud.la/%E6%A8%AA%E5%B1%8F/%E9%A3%8E%E6%99%AF/1.jpg?sign=d3447047ac694d8fb125ecd8e5eb409e&t=1677243042'
      },
    ],
  navlist:[
    {
      id:'1',
      active:'active',
      title:'春江花月夜',
    },
    {
      id:'2',
      title:'长恨歌'
    },
    {
      id:'3',
      title:'琵琶行'
    },
    
    {
      id:'5',
      title:'滕王阁序'
    },
    {
      id:'6',
      title:'出师表'
    },
    {
      id:'7',
      title:'渔家傲'
    },
    {
      id:'8',
      title:'雨霖铃'
    },
    {
      id:'9',
      title:'沁园春·雪'
    },
    {
      id:'10',
      title:'水调歌头'
    },
    {
      id:'11',
      title:'视觉'
    },
    {
      id:'12',
      title:'品牌'
    },
  ],

   newsinfo:[
    {
      id:'1',
      pagelistshow:'block',
      title:'春江花月夜',
      name:'张若虚',
      components:"hot"
        },
    {
      id:'2',
      pagelistshow:'none',
      title:'长恨歌',
      name:'白居易',
      components:'recommend',
    },
    {
      id:'3',
      pagelistshow:'none',
      components:'important',
      name:'白居易',
      title:'琵琶行'
    },
  
    {
      id:'5',
      pagelistshow:'none',
      title:'滕王阁序',
      name:'王勃',
      components:'money',
    },
    {
      id:'6',
      pagelistshow:'none',
      title:'出师表',
      name:'诸葛亮',
      components:'situation',
    },
    {
      id:'7',
      pagelistshow:'none',
      title:'渔家傲',
      name:'范仲淹',
      components:'city'
    },
    {
      id:'8',
      pagelistshow:'none',
      title:'雨霖铃',
      name:'柳永',
      components:'culture'
    },
    {
      id:'9',
      pagelistshow:'none',
      title:'沁园春·雪',
      name:'毛泽东',
      components:'world'
    },
    {
      id:'10',
      pagelistshow:'none',
      title:'水调歌头',
      name:'苏轼',
      components:'people'
    },
    {
      id:'11',
      pagelistshow:'none',
      title:'视觉',
      components:'vision'
    },
    {
      id:'12',
      pagelistshow:'none',
      title:'品牌',
      components:'logo'
    },
   ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },
  tabName(e){
    console.log(e.target.dataset.index);
    this.data.newsinfo.forEach((v,k)=>{
      if(v.id==e.target.dataset.id){
        this.setData({
          ['newsinfo['+k+'].pagelistshow']:'block',
          ['navlist['+k+'].active']:'active'
        })
      }else{
        this.setData({
          ['navlist['+k+'].active']:'',
          ['newsinfo['+k+'].pagelistshow']:'none'
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})